﻿using FluentValidation;
using System;
using System.Collections.Generic;
using System.Text;

namespace TL_Cloud.ViewModels.BookShop.BKInfo
{
    public class BKInfoAddOrUpdateResourceValidator<T> : AbstractValidator<T>
          where T : BKInfoBasicResource
    {
        public BKInfoAddOrUpdateResourceValidator()
        {
            RuleFor(x => x.BookName)
                 .NotNull()
                 .WithName("图书名称")
                 .WithMessage("required|{PropertyName}是必填的")
                 .MaximumLength(50)
                 .WithMessage("maxlength|{PropertyName}的最大长度是{MaxLength}");


            RuleFor(x => x.BKTypeId)
                 .NotNull()
                 .WithName("图书类型")
                 .WithMessage("required|{PropertyName}是必填的")
                 .MaximumLength(50)
                 .WithMessage("maxlength|{PropertyName}的最大长度是{MaxLength}");

            RuleFor(x => x.ConverUrl)
               .MaximumLength(50)
               .WithMessage("maxlength|{PropertyName}的最大长度是{MaxLength}");

            RuleFor(x => x.Author)
            .MaximumLength(255)
            .WithMessage("maxlength|{PropertyName}的最大长度是{MaxLength}");

            RuleFor(x => x.Isbn)
         .MaximumLength(50)
         .WithMessage("maxlength|{PropertyName}的最大长度是{MaxLength}");

            RuleFor(x => x.Pulisher)
       .MaximumLength(50)
       .WithMessage("maxlength|{PropertyName}的最大长度是{MaxLength}");


        }
    }
}
